<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<title>IupThread</title>

<link rel="stylesheet" type="text/css" href="../../style.css">
<style type="text/css">
.auto-style1 {
	font-size: large;
}
</style>
</head>
<body>
<div id="navigation">
  <ul>
    <li><a href="#Creation">Creation</a></li>
    <li><a href="#Attributes">Attributes</a></li>
    <li><a href="#Callbacks">Callbacks</a></li>
    <li><a href="#Notes">Notes</a></li>
    <li><a href="#Examples">Examples</a></li>
    <li><a href="#SeeAlso">See Also</a></li>
  </ul>
</div>

<h2>IupThread<span class="auto-style1"> (since 3.28)</span></h2>

  <p>
  Creates a thread element in IUP, which is not associated to any interface 
  element. It is a very simple support to create and manage threads in a 
  multithread environment.</p>
<p>
  It inherits from <a href="iupuser.html">IupUser</a>.</p>
<p>
  In non Windows systems uses the <strong>pthreads</strong> library.</p>

<h3><a name="Creation">Creation</a></h3>
<pre>Ihandle* IupThread(void); [in C]
iup.thread{} -&gt; (<strong>ih</strong>: ihandle) [in Lua]
thread() [in LED]</pre>
  <p>
  <u>Returns:</u> the identifier of the 
  created element, or NULL if an error occurs.</p>


<h3><a name="Attributes">Attributes</a></h3>


<p><b>START</b> (<font SIZE="3">write-only, non inheritable</font>): 
starts the thread and calls the callback. Can be YES only. The thread exits when 
the callback is terminated.</p>
<p><strong>EXIT</strong> (<font SIZE="3">write-only, non inheritable</font>): 
exit the current thread. Value contains the exit code. </p>
<p><strong>ISCURRENT</strong> (read-only<font SIZE="3">, non inheritable</font>): 
returns if the started thread is the current thread.</p>
<p><strong>YIELD</strong> (<font SIZE="3">write-only, non inheritable</font>): 
yield execution to another thread. value is ignored.</p>
<p><strong>JOIN</strong> (<font SIZE="3">write-only, non inheritable</font>):
<span>Waits until&nbsp;</span>thread<span>&nbsp;finishes. value is ignored.</span></p>
<p><b>LOCK</b> (<font SIZE="3">non inheritable</font>): 
uses a mutex to create a lock to allow access to shared data. Can be YES or NO. 
When set to YES the mutex will be locked, when set to NO the mutex will be 
unlocked. It does not depends if the thread is started or not.</p>


<h3><a name="Callbacks">Callbacks</a></h3>


<p><strong>THREAD_CB</strong>:
  Action generated when the thread is started. If this callback returns or does 
not exist the thread is terminated.</p>

  
    
<pre>int function(Ihandle*<strong> ih</strong>); [in C]<br><strong>ih</strong>:thread_cb() -&gt; (<strong>ret</strong>: number) [in Lua]</pre>

    
<p class="info"><strong>ih</strong>:
  identifier of the element that activated the 
  event.&nbsp;</p>

  
<p>&nbsp;</p>

    
</body>

</html>